﻿<Page
    x:Class="DvachBrowser3.Views.BoardPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:DvachBrowser3.Views"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="using:DvachBrowser3.ViewModels"
    xmlns:pa="using:DvachBrowser3.Views.Partial"
    xmlns:behaviors="using:Template10.Behaviors"
    xmlns:ps="using:DvachBrowser3.PageServices"
    xmlns:localBehaviors="using:DvachBrowser3.Behaviors"
    xmlns:controls="using:Template10.Controls"
    xmlns:interactivity="using:Microsoft.Xaml.Interactivity"
    mc:Ignorable="d" KeyDown="BoardPage_OnKeyDown">

    <ps:PageServices.Services>
        <ps:PageServiceCollection>
            <ps:ShellAppBarPageService />
            <ps:ViewModelLifetimePageService />
            <ps:StoreNavigationDataPageService MinutesToStore="60" Version="1.0.0"/>
        </ps:PageServiceCollection>
    </ps:PageServices.Services>

    <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

        <VisualStateManager.VisualStateGroups>
            <VisualStateGroup x:Name="VisualStateGroup">
                <VisualState x:Name="VisualStateNarrow">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NarrowMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>
                <VisualState x:Name="VisualStateNormal">
                    <VisualState.StateTriggers>
                        <AdaptiveTrigger MinWindowWidth="{StaticResource NormalMinWidth}" />
                    </VisualState.StateTriggers>
                    <VisualState.Setters>
                    </VisualState.Setters>
                </VisualState>
            </VisualStateGroup>
        </VisualStateManager.VisualStateGroups>


        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="100*"/>
        </Grid.RowDefinitions>

        <!--  header  -->
        <controls:PageHeader BackButtonVisibility="Collapsed" Frame="{x:Bind Frame, Mode=OneWay}" FontWeight="Bold"
                             Content="ДОСКА">
            <interactivity:Interaction.Behaviors>
                <behaviors:EllipsisBehavior Visibility="Collapsed" />
            </interactivity:Interaction.Behaviors>
        </controls:PageHeader>
        <pa:ProgressIndicatorControl Grid.Row="1" ViewModel="{x:Bind ViewModel.Update.Progress, Mode=OneWay}" ShowMessage="True" />
        <pa:BoardThreadRefList x:Name="MainList" Grid.Row="2" ViewModel="{x:Bind ViewModel.Page, Mode=OneWay}" ThreadTapped="MainList_OnThreadTapped" Margin="4, 4, 4, 0" 
                               ListTitle="{x:Bind ViewModel.TitleWithPage, Mode=OneWay}"/> 
        <pa:ContentPopup Grid.Row="1" x:Name="ThreadPreviewPopup" Grid.RowSpan="2" IsContentVisibleChanged="Popup_OnIsContentVisibleChanged">
            <pa:ContentPopup.ViewContent>
                <pa:PostCollectionView x:Name="ThreadPreview" MaxLines="20" ShowCounter="False" ShowPreviewSeparator="True" ShowFullThreadText="Перейти в тред"
                                       ShowFullThread="ThreadPreview_OnShowFullThread"/>
            </pa:ContentPopup.ViewContent>
        </pa:ContentPopup>
    </Grid>
</Page>
